def fibonacci(num):
    a = 0
    b = 1

    # 记录生成fibonacci数字的下标
    current_index = 0

    while current_index < num:
        result = a
        a, b = b, a + b
        current_index += 1
        yield result

if __name__ == '__main__':
    for i in fibonacci(10):
        print(i)
